package com.ruoyi.goodsDetail.service.impl;

import java.util.List;

import com.ruoyi.businessOrder.domain.BusinessOrder;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.goodsDetail.mapper.OrderGoodsDetailMapper;
import com.ruoyi.goodsDetail.domain.OrderGoodsDetail;
import com.ruoyi.goodsDetail.service.IOrderGoodsDetailService;
import com.ruoyi.goodsDetail.service.IRemoteOrderGoodsDetailService;

/**
 * 商品订单详情信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-05
 */
@Service
public class OrderGoodsDetailServiceImpl implements IOrderGoodsDetailService, IRemoteOrderGoodsDetailService
{
    @Autowired
    private OrderGoodsDetailMapper orderGoodsDetailMapper;

    /**
     * 查询商品订单详情信息
     * 
     * @param detailId 商品订单详情信息主键
     * @return 商品订单详情信息
     */
    @Override
    public OrderGoodsDetail selectOrderGoodsDetailByDetailId(Long detailId)
    {
        return orderGoodsDetailMapper.selectOrderGoodsDetailByDetailId(detailId);
    }

    /**
     * 查询商品订单详情信息列表
     * 
     * @param orderGoodsDetail 商品订单详情信息
     * @return 商品订单详情信息
     */
    @Override
    public List<OrderGoodsDetail> selectOrderGoodsDetailList(OrderGoodsDetail orderGoodsDetail)
    {
        return orderGoodsDetailMapper.selectOrderGoodsDetailList(orderGoodsDetail);
    }

    /**
     * 新增商品订单详情信息
     * 
     * @param orderGoodsDetail 商品订单详情信息
     * @return 结果
     */
    @Override
    public int insertOrderGoodsDetail(OrderGoodsDetail orderGoodsDetail)
    {
        orderGoodsDetail.setCreateTime(DateUtils.getNowDate());
        return orderGoodsDetailMapper.insertOrderGoodsDetail(orderGoodsDetail);
    }

    /**
     * 修改商品订单详情信息
     * 
     * @param orderGoodsDetail 商品订单详情信息
     * @return 结果
     */
    @Override
    public int updateOrderGoodsDetail(OrderGoodsDetail orderGoodsDetail)
    {
        orderGoodsDetail.setUpdateTime(DateUtils.getNowDate());
        return orderGoodsDetailMapper.updateOrderGoodsDetail(orderGoodsDetail);
    }

    /**
     * 批量删除商品订单详情信息
     * 
     * @param detailIds 需要删除的商品订单详情信息主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsDetailByDetailIds(Long[] detailIds)
    {
        return orderGoodsDetailMapper.deleteOrderGoodsDetailByDetailIds(detailIds);
    }

    /**
     * 删除商品订单详情信息信息
     * 
     * @param detailId 商品订单详情信息主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsDetailByDetailId(Long detailId)
    {
        return orderGoodsDetailMapper.deleteOrderGoodsDetailByDetailId(detailId);
    }

    /**
     * 根据订单id查询商品订单详情信息
     *
     * @param orderId 订单id
     * @return 商品订单详情信息
     */
    @Override
    public OrderGoodsDetail selectOrderGoodsDetailByOrderId(Long orderId) {

        return orderGoodsDetailMapper.selectOrderGoodsDetailByOrderId(orderId);
    }
}
